<template>
  <div>
    <el-row :gutter="15">

      <el-dialog  :visible.sync="onOpen" title="修改区域" :close-on-click-modal="false"
               append-to-body
                 width="800px" :modal-append-to-body="false"
      >
        <div class="address-selector">
        <div class="select-group" >
          <div class="select-wrapper">
            <select v-model="selectedProvince" @change="onProvinceChange">
              <option value="">请选择省份</option>
              <option v-for="province in provinces" :value="province.name">{{ province.name }}</option>
            </select>
          </div>

          <div class="select-wrapper">
            <select v-model="selectedCity" @change="onCityChange" :disabled="!cities.length">
              <option value="">请选择城市</option>
              <option v-for="city in cities" :value="city.name">{{ city.name }}</option>
            </select>
          </div>

          <div class="select-wrapper">
            <select v-model="selectedDistrict" @change="onDistrictChange" :disabled="!districts.length">
              <option value="">请选择区县</option>
              <option v-for="district in districts" :value="district.name">{{ district.name }}</option>
            </select>
          </div>

          <div class="select-wrapper">
            <select v-model="selectedStreet" @change="onStreetChange" :disabled="!streets.length">
              <option value="">请选择街道</option>
              <option v-for="street in streets" :value="street.name">{{ street.name }}</option>
            </select>
          </div>
        </div>
        </div>



      <el-row>
         <div style="margin-left: 80%;margin-top: 30px">
           <el-button @click="onOpen=false">取消</el-button>
           <el-button type="primary" @click="confirmQy">确定</el-button>
         </div>
      </el-row>
      </el-dialog>

      <el-tabs v-model="activexdivdv" tab-position="top" class="mb-20">
        <el-tab-pane label="原数据">

          <el-form ref="elForm" :model="dataForm.oldData" :disabled="true" size="small" label-width="120px"
                   label-position="right"
          >
            <template>
              <!--          v-if="!loading && formOperates"-->
              <el-card class="mb-20" shadow="always" header="基础信息">
                <el-row>

                  <el-col :span="8" v-if="judgeShow('zcLabel')"
                  >
                    <el-form-item label="资产类别"
                                  prop="assetClass"
                    >
                      <el-select v-model="dataForm.oldData.assetClass" v-if="!setting.readonly"
                                 placeholder="请选择" :disabled="judgeWrite('assetClass')" clearable
                                 :style='{"width":"100%"}'
                      >
                        <el-option v-for="(item, index) in assetClassOptions" :key="index" :label="item.fullName"
                                   :value="item.enCode" :disabled="item.disabled"
                        ></el-option>
                      </el-select>
                      <span class="value"
                            v-if="setting.readonly"
                      >{{ getOptionLabel(assetClassOptions, dataForm.oldData.assetClass) || '-' }}</span>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8" v-if="judgeShow('zcNumber')"
                  >
                    <el-form-item label="资产编号"
                                  prop="zcNumber"
                    >
                      <el-input v-model="dataForm.oldData.zcNumber" v-if="!setting.readonly"
                                placeholder="请输入" :disabled="judgeWrite('zcNumber')" clearable :style='{"width":"100%"}'
                      >
                      </el-input>
                      <span class="value" v-if="setting.readonly">{{ dataForm.oldData.zcNumber || '-' }}</span>
                    </el-form-item>
                  </el-col>

                  <el-col :span="8" v-if="judgeShow('zcName')"
                  >
                    <el-form-item label="资产名称"
                                  prop="zcName"
                    >
                      <el-input v-model="dataForm.oldData.zcName" v-if="!setting.readonly"
                                placeholder="请输入" :disabled="judgeWrite('zcName')" clearable :style='{"width":"100%"}'
                      >
                      </el-input>
                      <span class="value" v-if="setting.readonly">{{ dataForm.oldData.zcName || '-' }}</span>
                    </el-form-item>
                  </el-col>

                </el-row>

                <el-row>
                  <el-col :span="8" v-if="judgeShow('address')"
                  >
                    <el-form-item label="所属项目"
                                  prop="belongingProject"
                    >
                      <el-input v-model="dataForm.oldData.belongingProject" v-if="!setting.readonly"
                                placeholder="请输入" :disabled="judgeWrite('belongingProject')" clearable
                                :style='{"width":"100%"}'
                      >

                      </el-input>
                      <span class="value" v-if="setting.readonly">{{ dataForm.oldData.belongingProject || '-' }}</span>
                    </el-form-item>
                  </el-col>

                  <el-col :span="8" v-if="judgeShow('address')"
                  >
                    <el-form-item label="所属楼栋"
                                  prop="belongingBuilding"
                    >
                      <el-input v-model="dataForm.oldData.belongingBuilding" v-if="!setting.readonly"
                                placeholder="请输入" :disabled="judgeWrite('belongingBuilding')" clearable
                                :style='{"width":"100%"}'
                      >

                      </el-input>
                      <span class="value" v-if="setting.readonly">{{ dataForm.oldData.belongingBuilding || '-' }}</span>
                    </el-form-item>
                  </el-col>

                  <el-col :span="8" v-if="judgeShow('address')">
                    <el-form-item label="坐落位置" prop="address">
                      <div v-if="!setting.readonly">
                        <el-input v-model="dataForm.oldData.address" :disabled="judgeWrite('address')" clearable
                                  :style='{"width":"100%"}'
                        ></el-input>
                        <el-button @click="openDialog">选择位置</el-button>
                        <span class="value" v-if="!setting.readonly && dataForm.oldData.longitude"
                              style="color:grey;font-size:12px"
                        >(经度：{{ dataForm.oldData.longitude }},维度：{{ dataForm.oldData.latitude }})</span>
                      </div>
                      <span class="value" v-if="setting.readonly">{{
                          dataForm.oldData.address || '-'
                        }}{{ dataForm.oldData.longitude }},{{ dataForm.oldData.latitude }}</span>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8" v-if="judgeShow('address')"
                  >
                    <el-form-item label="资产使用情况"
                                  prop="zcStatus"
                    >
                      <el-select v-model="dataForm.oldData.zcStatus" v-if="!setting.readonly"
                                 placeholder="请选择" :disabled="judgeWrite('zcStatus')" clearable
                                 :style='{"width":"100%"}'
                      >
                        <el-option v-for="(item, index) in zcStatusOptions" :key="index" :label="item.fullName"
                                   :value="item.enCode" :disabled="item.disabled"
                        ></el-option>

                      </el-select>
                      <span class="value" v-if="setting.readonly">{{
                          getOptionLabel(zcStatusOptions, dataForm.oldData.zcStatus) || '-'
                        }}</span>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8" v-if="judgeShow('zcPurpose')"
                  >
                    <el-form-item label="资产用途"
                                  prop="zcPurpose"
                    >
                      <el-select v-model="dataForm.oldData.zcPurpose" v-if="!setting.readonly"
                                 placeholder="请选择" :disabled="judgeWrite('zcPurpose')" clearable
                                 :style='{"width":"100%"}'
                      >
                        <el-option v-for="(item, index) in zcPurposeOptions" :key="index" :label="item.fullName"
                                   :value="item.enCode" :disabled="item.disabled"
                        ></el-option>

                      </el-select>
                      <span class="value"
                            v-if="setting.readonly"
                      >{{ getOptionLabel(zcPurposeOptions, dataForm.oldData.zcPurpose) || '-' }}</span>
                    </el-form-item>
                  </el-col>

                  <el-col :span="8" v-if="judgeShow('zcPurposeDescribe') &&  dataForm.oldData.zcPurpose=='3'"
                  >
                    <el-form-item label="其他用途说明"
                                  prop="zcPurposeDescribe"
                    >
                      <el-input v-model="dataForm.oldData.zcPurposeDescribe" v-if="!setting.readonly"
                                placeholder="请输入" :disabled="judgeWrite('zcPurposeDescribe')" clearable
                                :style='{"width":"100%"}'
                      >

                      </el-input>
                      <span class="value" v-if="setting.readonly">{{ dataForm.oldData.zcPurposeDescribe || '-' }}</span>
                    </el-form-item>
                  </el-col>


                  <el-col :span="8" v-if="judgeShow('zcSource')"
                  >
                    <el-form-item label="资产来源"
                                  prop="zcSource"
                    >
                      <el-select v-model="dataForm.oldData.zcSource" v-if="!setting.readonly"
                                 placeholder="请选择" :disabled="judgeWrite('zcSource')" clearable
                                 :style='{"width":"100%"}'
                      >
                        <el-option v-for="(item, index) in zcSourceOptions" :key="index" :label="item.fullName"
                                   :value="item.enCode" :disabled="item.disabled"
                        ></el-option>

                      </el-select>
                      <span class="value" v-if="setting.readonly">{{
                          getOptionLabel(zcSourceOptions, dataForm.oldData.zcSource) || '-'
                        }}</span>
                    </el-form-item>
                  </el-col>


                  <el-col :span="8" v-if="judgeShow('zcSourceDescribe') &&  dataForm.oldData.zcSource=='lyqt'"
                  >
                    <el-form-item label="资产来源说明"
                                  prop="zcPurposeDescribe"
                    >
                      <el-input v-model="dataForm.oldData.zcSourceDescribe" v-if="!setting.readonly"
                                placeholder="请输入" :disabled="judgeWrite('zcSourceDescribe')" clearable
                                :style='{"width":"100%"}'
                      >

                      </el-input>
                      <span class="value" v-if="setting.readonly">{{ dataForm.oldData.zcSourceDescribe || '-' }}</span>
                    </el-form-item>
                  </el-col>


                  <el-col :span="8" v-if="judgeShow('jnpf_zcgl_zcdj_photo_jnpf_photoTime')"
                  >
                    <el-form-item label="取得日期"
                                  prop="acquisitionDate"
                    >
                      <el-date-picker v-if="!setting.readonly" v-model="dataForm.oldData.acquisitionDate"
                                      placeholder="请选择" :disabled="judgeWrite('acquisitionDate')"
                                      clearable :style='{"width":"100%"}' type="date" format="yyyy-MM-dd"
                      >
                      </el-date-picker>

                      <span class="value" v-if="setting.readonly">{{ dataForm.oldData.acquisitionDate || '-' }}</span>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8" v-if="judgeShow('address')"
                  >
                    <el-form-item label="取得价值(万元)"
                                  prop="acquiringValue"
                    >
                      <el-input v-model="dataForm.oldData.acquiringValue" v-if="!setting.readonly"
                                placeholder="请输入" :disabled="judgeWrite('acquiringValue')" clearable
                                :style='{"width":"100%"}'
                      >

                      </el-input>
                      <span class="value" v-if="setting.readonly">{{ dataForm.oldData.acquiringValue || '-' }}</span>
                    </el-form-item>
                  </el-col>

                  <el-col :span="8" v-if="judgeShow('holdingMethod')"
                  >
                    <el-form-item label="持有方式"
                                  prop="holdingMethod"
                    >
                      <el-select v-model="dataForm.oldData.holdingMethod" v-if="!setting.readonly"
                                 placeholder="请选择" :disabled="judgeWrite('holdingMethod')" clearable
                                 :style='{"width":"100%"}'
                      >
                        <el-option v-for="(item, index) in holdingMethodOptions" :key="index" :label="item.fullName"
                                   :value="item.enCode" :disabled="item.disabled"
                        ></el-option>

                      </el-select>
                      <span class="value" v-if="setting.readonly">{{
                          getOptionLabel(holdingMethodOptions, dataForm.oldData.holdingMethod) || '-'
                        }}</span>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8" v-if="judgeShow('clientFullName') && dataForm.holdingMethod!='自持'"
                  >
                    <el-form-item label="委托方全称"
                                  prop="clientFullName"
                    >
                      <el-input v-model="dataForm.oldData.clientFullName" v-if="!setting.readonly"
                                placeholder="请输入" :disabled="judgeWrite('clientFullName')" clearable
                                :style='{"width":"100%"}'
                      >

                      </el-input>
                      <span class="value" v-if="setting.readonly">{{ dataForm.oldData.clientFullName }}</span>

                    </el-form-item>
                  </el-col>

                  <el-col :span="8" v-if="judgeShow('zcAdmin')"
                  >

                    <el-form-item label="资产管理员"
                                  prop="zcAdmin"
                    >
                      <!--                        <user-select v-model="dataForm.oldData.zcAdmin" v-if="!setting.readonly"-->
                      <!--                                     placeholder="请选择" :disabled="judgeWrite('zcAdmin')" clearable-->
                      <!--                        >-->


                      <!--                        </user-select>-->
                      <el-input v-model="dataForm.oldData.zcAdmin"
                                :style='{"width":"100%"}'
                      >

                      </el-input>
                    </el-form-item>
                  </el-col>
                  <!--            <el-col :span="8" v-if="judgeShow('managementUnit')"-->
                  <!--            >-->
                  <!--              <el-form-item label="管理单位"-->
                  <!--                            prop="managementUnit"-->
                  <!--              >-->
                  <!--                <el-select v-model="dataForm.managementUnit" v-if="!setting.readonly"-->
                  <!--                           placeholder="请选择" :disabled="judgeWrite('managementUnit')" clearable-->
                  <!--                           :style='{"width":"100%"}'-->
                  <!--                >-->
                  <!--                  <el-option v-for="(item, index) in managementUnitOptions" :key="index" :label="item.fullName"-->
                  <!--                             :value="item.enCode" :disabled="item.disabled"-->
                  <!--                  ></el-option>-->

                  <!--                </el-select>-->
                  <!--                <span class="value" v-if="setting.readonly">{{-->
                  <!--                    getOptionLabel(managementUnitOptions, dataForm.managementUnit) || '-'-->
                  <!--                  }}</span>-->

                  <!--              </el-form-item>-->
                  <!--            </el-col>-->

                  <el-col :span="8" v-if="judgeShow('managementUnit')">
                    <el-form-item label="管理单位" prop="managementUnit">
                      <el-input
                        v-model="dataForm.oldData.managementUnit"
                        v-if="!setting.readonly"
                        placeholder="请输入"
                        :disabled="judgeWrite('managementUnit')"
                        clearable
                        :style="{ 'width': '100%' }"
                      ></el-input>
                    </el-form-item>
                  </el-col>

                  <el-col :span="14" v-if="judgeShow('notes')"
                  >
                    <el-form-item label="备注"
                                  prop="notes"
                    >
                      <el-input v-model="dataForm.oldData.notes" v-if="!setting.readonly"
                                placeholder="请输入" :disabled="judgeWrite('notes')" :style='{"width":"100%"}' true
                                type="textarea" :autosize='{"minRows":4,"maxRows":4}'
                      >

                      </el-input>
                      <span class="value notes" v-if="setting.readonly">{{ dataForm.oldData.notes || '-' }}</span>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-col :span="6" v-if="judgeShow('zcFile')"
                >
                  <el-form-item label="资产附件"
                                prop="zcFile"
                  >
                    <JNPF-UploadFz v-model="dataForm.oldData.zcFile"
                                   :fileSize="10" :disabled="judgeWrite('zcFile')" sizeUnit="MB" :limit="9"
                                   buttonText="点击上传"
                    >

                    </JNPF-UploadFz>
                  </el-form-item>
                </el-col>
              </el-card>
            </template>
          </el-form>
        </el-tab-pane>

        <el-tab-pane label="变更数据">
          <el-form ref="elForm" :model="dataForm.newData" :rules="dataRule" size="small" label-width="120px"
                   label-position="right" :disabled="setting.readonly"
          >
            <template>
              <!--          v-if="!loading && formOperates"-->
              <el-card class="mb-20" shadow="always" header="基础信息">
                <el-row>

                  <el-col :span="24" v-if="!setting.readonly"
                  >
                    <el-form-item label="流程标题"
                                  prop="title"
                    >
                      <el-input v-model="dataForm.newData.title" v-if="!setting.readonly"
                                placeholder="请输入" clearable :style='{"width":"100%"}'
                      >
                      </el-input>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8" v-if="judgeShow('zcLabel')"
                  >
                    <el-form-item label="资产类别"
                                  prop="assetClass"
                    >
                      <el-select v-model="dataForm.newData.assetClass" v-if="!setting.readonly"
                                 placeholder="请选择" :disabled="judgeWrite('assetClass')" clearable
                                 :style='{"width":"100%"}'
                      >
                        <el-option v-for="(item, index) in assetClassOptions" :key="index" :label="item.fullName"
                                   :value="item.enCode" :disabled="item.disabled"
                        ></el-option>
                      </el-select>
                      <span class="value"
                            v-if="setting.readonly"
                      >{{ getOptionLabel(assetClassOptions, dataForm.newData.assetClass) || '-' }}</span>
                    </el-form-item>
                  </el-col>


                  <el-col :span="8" v-if="judgeShow('zcType')"
                  >
                    <el-form-item label="资产类型"
                                  prop="zcType"
                    >
                      <el-select v-model="dataForm.newData.zcType" v-if="!setting.readonly"
                                 placeholder="请选择" :disabled="judgeWrite('zcType')" clearable :style='{"width":"100%"}'
                      >
                        <el-option v-for="(item, index) in assetTypeOptions" :key="index" :label="item.fullName"
                                   :value="item.enCode" :disabled="item.disabled"
                        ></el-option>
                      </el-select>
                      <span class="value"
                            v-if="setting.readonly"
                      >{{ getOptionLabel(assetTypeOptions, dataForm.newData.zcType) || '-' }}</span>
                    </el-form-item>
                  </el-col>


                  <el-col :span="8" v-if="judgeShow('zcNumber')"
                  >
                    <el-form-item label="资产编号"
                                  prop="zcNumber"
                    >
                      <el-input v-model="dataForm.newData.zcNumber" v-if="!setting.readonly"
                                placeholder="请输入" :disabled="judgeWrite('zcNumber')" clearable :style='{"width":"100%"}'
                      >
                      </el-input>
                      <span class="value" v-if="setting.readonly">{{ dataForm.newData.zcNumber || '-' }}</span>
                    </el-form-item>
                  </el-col>

                  <el-col :span="8" v-if="judgeShow('zcName')"
                  >
                    <el-form-item label="资产名称"
                                  prop="zcName"
                    >
                      <el-input v-model="dataForm.newData.zcName" v-if="!setting.readonly"
                                placeholder="请输入" :disabled="judgeWrite('zcName')" clearable :style='{"width":"100%"}'
                      >
                      </el-input>
                      <span class="value" v-if="setting.readonly">{{ dataForm.newData.zcName || '-' }}</span>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8" v-if="judgeShow('address')"
                  >
                    <el-form-item label="所属项目"
                                  prop="belongingProject"
                    >
                      <el-input v-model="dataForm.newData.belongingProject" v-if="!setting.readonly"
                                placeholder="请输入" :disabled="judgeWrite('belongingProject')" clearable
                                :style='{"width":"100%"}'
                      >

                      </el-input>
                      <span class="value" v-if="setting.readonly">{{ dataForm.newData.belongingProject || '-' }}</span>
                    </el-form-item>
                  </el-col>

                  <el-col :span="8" v-if="judgeShow('address')"
                  >
                    <el-form-item label="所属楼栋"
                                  prop="belongingBuilding"
                    >
                      <el-input v-model="dataForm.newData.belongingBuilding" v-if="!setting.readonly"
                                placeholder="请输入" :disabled="judgeWrite('belongingBuilding')" clearable
                                :style='{"width":"100%"}'
                      >

                      </el-input>
                      <span class="value" v-if="setting.readonly">{{ dataForm.newData.belongingBuilding || '-' }}</span>
                    </el-form-item>
                  </el-col>
                </el-row>

                <el-row>
                  <el-col :span="8" v-if="judgeShow('address')">
                    <el-form-item label="区域" prop="address">
                      <div class="address-selector">

                        <div class="result" v-if="!setting.readonly">
                          <p>{{ dataForm.newData.provinceName }} {{ dataForm.newData.cityName }}
                            {{ dataForm.newData.districtName }} {{ dataForm.newData.streetName }}</p>
                        </div>
                        <div>
                          <el-button @click="openDialogQuYu">修改区域</el-button>
                        </div>
                      </div>
                    </el-form-item>
                  </el-col>

                  <el-col :span="8" v-if="judgeShow('address')">


                    <el-form-item label="坐落位置" prop="address">
                      <div v-if="!setting.readonly">
                        <el-input v-model="dataForm.newData.address" :disabled="judgeWrite('address')" clearable
                                  :style='{"width":"100%"}'
                        ></el-input>
                        <el-button @click="openDialog">选择位置</el-button>
                        <span class="value" v-if="!setting.readonly && dataForm.newData.longitude"
                              style="color:grey;font-size:12px"
                        >(经度：{{ dataForm.newData.longitude }},维度：{{ dataForm.newData.latitude }})</span>
                      </div>
                      <span class="value" v-if="setting.readonly">{{
                          dataForm.newData.address || '-'
                        }}{{ dataForm.newData.longitude }},{{ dataForm.newData.latitude }}</span>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8" v-if="judgeShow('address')"
                  >
                    <el-form-item label="资产使用情况"
                                  prop="zcStatus"
                    >
                      <el-select v-model="dataForm.newData.zcStatus" v-if="!setting.readonly"
                                 placeholder="请选择" :disabled="judgeWrite('zcStatus')" clearable
                                 :style='{"width":"100%"}'
                      >
                        <el-option v-for="(item, index) in zcStatusOptions" :key="index" :label="item.fullName"
                                   :value="item.enCode" :disabled="item.disabled"
                        ></el-option>

                      </el-select>
                      <span class="value" v-if="setting.readonly">{{
                          getOptionLabel(zcStatusOptions, dataForm.newData.zcStatus) || '-'
                        }}</span>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8" v-if="judgeShow('zcPurpose')"
                  >
                    <el-form-item label="资产用途"
                                  prop="zcPurpose"
                    >
                      <el-select v-model="dataForm.newData.zcPurpose" v-if="!setting.readonly"
                                 placeholder="请选择" :disabled="judgeWrite('zcPurpose')" clearable
                                 :style='{"width":"100%"}'
                      >
                        <el-option v-for="(item, index) in zcPurposeOptions" :key="index" :label="item.fullName"
                                   :value="item.enCode" :disabled="item.disabled"
                        ></el-option>

                      </el-select>
                      <span class="value"
                            v-if="setting.readonly"
                      >{{ getOptionLabel(zcPurposeOptions, dataForm.newData.zcPurpose) || '-' }}</span>
                    </el-form-item>
                  </el-col>

                  <el-col :span="8" v-if="judgeShow('zcPurposeDescribe') &&  dataForm.newData.zcPurpose=='其他'"
                  >
                    <el-form-item label="其他用途说明"
                                  prop="zcPurposeDescribe"
                    >
                      <el-input v-model="dataForm.newData.zcPurposeDescribe" v-if="!setting.readonly"
                                placeholder="请输入" :disabled="judgeWrite('zcPurposeDescribe')" clearable
                                :style='{"width":"100%"}'
                      >

                      </el-input>
                      <span class="value" v-if="setting.readonly">{{ dataForm.newData.zcPurposeDescribe || '-' }}</span>
                    </el-form-item>
                  </el-col>


                  <el-col :span="8" v-if="judgeShow('zcSource')"
                  >
                    <el-form-item label="资产来源"
                                  prop="zcSource"
                    >
                      <el-select v-model="dataForm.newData.zcSource" v-if="!setting.readonly"
                                 placeholder="请选择" :disabled="judgeWrite('zcSource')" clearable
                                 :style='{"width":"100%"}'
                      >
                        <el-option v-for="(item, index) in zcSourceOptions" :key="index" :label="item.fullName"
                                   :value="item.enCode" :disabled="item.disabled"
                        ></el-option>

                      </el-select>
                      <span class="value" v-if="setting.readonly">{{
                          getOptionLabel(zcSourceOptions, dataForm.newData.zcSource) || '-'
                        }}</span>
                    </el-form-item>
                  </el-col>

                  <el-col :span="8" v-if="judgeShow('zcSourceDescribe') &&  dataForm.zcSource  == '其它'"
                  >
                    <el-form-item label="其他资产来源说明"
                                  prop="zcPurposeDescribe"
                    >
                      <el-input v-model="dataForm.newData.zcSourceDescribe" v-if="!setting.readonly"
                                placeholder="请输入" :disabled="judgeWrite('zcSourceDescribe')" clearable
                                :style='{"width":"100%"}'
                      >

                      </el-input>
                      <span class="value" v-if="setting.readonly">{{ dataForm.newData.zcSourceDescribe || '-' }}</span>
                    </el-form-item>
                  </el-col>


                  <el-col :span="8" v-if="judgeShow('jnpf_zcgl_zcdj_photo_jnpf_photoTime')"
                  >
                    <el-form-item label="取得日期"
                                  prop="acquisitionDate"
                    >
                      <el-date-picker v-if="!setting.readonly" v-model="dataForm.newData.acquisitionDate"
                                      placeholder="请选择" :disabled="judgeWrite('acquisitionDate')"
                                      clearable :style='{"width":"100%"}' type="date" format="yyyy-MM-dd"
                      >
                      </el-date-picker>

                      <span class="value" v-if="setting.readonly">{{ dataForm.newData.acquisitionDate || '-' }}</span>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8" v-if="judgeShow('address')"
                  >
                    <el-form-item label="取得价值(万元)"
                                  prop="acquiringValue"
                    >
                      <el-input v-model="dataForm.newData.acquiringValue" v-if="!setting.readonly"
                                placeholder="请输入" :disabled="judgeWrite('acquiringValue')" clearable
                                :style='{"width":"100%"}'
                      >

                      </el-input>
                      <span class="value" v-if="setting.readonly">{{ dataForm.newData.acquiringValue || '-' }}</span>
                    </el-form-item>
                  </el-col>

                  <el-col :span="8" v-if="judgeShow('holdingMethod')"
                  >
                    <el-form-item label="持有方式"
                                  prop="holdingMethod"
                    >
                      <el-select v-model="dataForm.newData.holdingMethod" v-if="!setting.readonly"
                                 placeholder="请选择" :disabled="judgeWrite('holdingMethod')" clearable
                                 :style='{"width":"100%"}'
                      >
                        <el-option v-for="(item, index) in holdingMethodOptions" :key="index" :label="item.fullName"
                                   :value="item.enCode" :disabled="item.disabled"
                        ></el-option>

                      </el-select>
                      <span class="value" v-if="setting.readonly">{{
                          getOptionLabel(holdingMethodOptions, dataForm.newData.holdingMethod) || '-'
                        }}</span>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8" v-if="judgeShow('clientFullName') && dataForm.newData.holdingMethod!='自持'"
                  >
                    <el-form-item label="委托方全称"
                                  prop="clientFullName"
                    >
                      <el-input v-model="dataForm.newData.clientFullName" v-if="!setting.readonly"
                                placeholder="请输入" :disabled="judgeWrite('clientFullName')" clearable
                                :style='{"width":"100%"}'
                      >

                      </el-input>
                      <span class="value" v-if="setting.readonly">{{ dataForm.newData.clientFullName }}</span>

                    </el-form-item>
                  </el-col>

                  <el-col :span="8" v-if="judgeShow('zcAdmin')"
                  >
                    <el-form-item label="资产管理员"
                                  prop="zcAdmin"
                    >
                      <user-select v-model="dataForm.newData.zcAdmin" v-if="!setting.readonly"
                                   placeholder="请选择" :disabled="judgeWrite('zcAdmin')" clearable
                      >


                      </user-select>
                      <span class="value" v-if="setting.readonly">{{ dataForm.newData.zcAdmin }}</span>

                    </el-form-item>
                  </el-col>

                  <el-col :span="8" v-if="judgeShow('managementUnit')">
                    <el-form-item label="管理单位" prop="managementUnit">
                      <el-input
                        v-model="dataForm.newData.managementUnit"
                        v-if="!setting.readonly"
                        placeholder="请输入"
                        :disabled="judgeWrite('managementUnit')"
                        clearable
                        :style="{ 'width': '100%' }"
                      ></el-input>
                      <span class="value notes" v-if="setting.readonly">{{
                          dataForm.newData.managementUnit || '-'
                        }}</span>

                    </el-form-item>

                  </el-col>

                  <el-col :span="14" v-if="judgeShow('notes')"
                  >
                    <el-form-item label="备注"
                                  prop="notes"
                    >
                      <el-input v-model="dataForm.newData.notes" v-if="!setting.readonly"
                                placeholder="请输入" :disabled="judgeWrite('notes')" :style='{"width":"100%"}' true
                                type="textarea" :autosize='{"minRows":4,"maxRows":4}'
                      >

                      </el-input>
                      <span class="value notes" v-if="setting.readonly">{{ dataForm.newData.notes || '-' }}</span>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-col :span="6" v-if="judgeShow('zcFile')"
                >
                  <el-form-item label="资产附件"
                                prop="zcFile"
                  >
                    <JNPF-UploadFz v-model="dataForm.newData.zcFile"
                                   :fileSize="10" :disabled="judgeWrite('zcFile')" sizeUnit="MB" :limit="9"
                                   buttonText="点击上传"
                    >

                    </JNPF-UploadFz>
                  </el-form-item>
                </el-col>

              </el-card>
            </template>
          </el-form>
        </el-tab-pane>
      </el-tabs>


    </el-row>
    <UserBox v-if="userBoxVisible" ref="userBox" @submit="submit"/>
    <SelectDialog v-if="selectDialogVisible" :config="addTableConf" :formData="dataForm" ref="selectDialog"
                  @select="addForSelect" @close="selectDialogVisible=false"
    />
  </div>
</template>

<script>
import request from '@/utils/request'
import { getDataInterfaceRes } from '@/api/systemData/dataInterface'
import { getDictionaryDataSelector } from '@/api/systemData/dictionary'
import SelectDialog from '@/components/SelectDialog'
import axios from 'axios'
export default {
  components: { SelectDialog },
  props: [],
  data() {
    return {
      // 当前选择的值
      selectedProvince: '',
      selectedCity: '',
      selectedDistrict: '',
      selectedStreet: '',

      // 数据加载状态
      loadingCity: false,
      loadingDistrict: false,
      loadingStreet: false,

      // 下拉选项数据
      provinces: [],
      cities: [],
      districts: [],
      streets: [],

      zcStatusOptions: [],
      zcNatureOptions: [],
      zcNatureProps: { 'label': 'fullName', 'value': 'id' },
      zcPurposeOptions: [],
      zcPurposeProps: { 'label': 'fullName', 'value': 'id' },
      zcSourceOptions: [],
      zcSourceProps: { 'label': 'fullName', 'value': 'id' },
      affiliatedUnitOptions: [],
      affiliatedUnitProps: { 'label': 'fullName', 'value': 'id' },
      managementUnitOptions: [],
      managementUnitProps: { 'label': 'fullName', 'value': 'id' },
      jnpf_zcgl_zcdj_warrant_jnpf_propertyRightOptions: [],
      jnpf_zcgl_zcdj_warrant_jnpf_propertyRightProps: { 'label': 'fullName', 'value': 'id' },
      jnpf_zcgl_zcdj_warrant_jnpf_useNatureOptions: [],
      jnpf_zcgl_zcdj_warrant_jnpf_useNatureProps: { 'label': 'fullName', 'value': 'id' },
      activexdivdv: '1',
      selectDialogVisible: false,
      tableKey: '',
      addTableConf: {},
      loading: false,
      visible: false,
      onOpen: false,
      setting: {},
      eventType: '',
      userBoxVisible: false,
      tableRequiredData: {},
      primaryKeyPolicy: true,
      dataFormNew: {},
      dataForm: {
        title: '',
        remarks: '',
        oldData: {

          zcNumber: ''
        },
        newData: {},
        id: '',
        flowId: '',
        status: 1,
        candidateList: {},
        freeapproveruserid: '',
        branchList: [],
        errorRuleUserList: {},
        flowUrgent: 1,
        version: 0,
        flowtaskid: undefined,
        copyIds: '',
        project: '',
        customerName: '',
        contractNo: '',
        paymentBy: '',
        billType: '',
        expenseStartDate: '',
        expenseEndDate: '',
        planReceiptDate: '',
        billRemark: '',

        holdingMethodOptions: [],
        zcbillitemList: [],
        assetClassOptions: [],
        zcStatusOptions: []
      },
      dataRule:
        {
          'zcNumber': [{ 'required': true, 'message': 'zcNumber不能为空', 'trigger': 'blur' }],
          'zcName': [{ 'required': true, 'message': 'zcName不能为空', 'trigger': 'blur' }],
          'address': [{ 'required': true, 'message': 'address不能为空', 'trigger': 'blur' }],
          'zcNature': [{ 'required': true, 'message': 'zcNature不能为空', 'trigger': 'blur' }],
          'zcSource': [{ 'required': true, 'message': 'zcSource不能为空', 'trigger': 'blur' }],
          'affiliatedUnit': [{ 'required': true, 'message': '权属单位不能为空', 'trigger': 'blur' }],
          'managementUnit': [{ 'required': true, 'message': '管理单位不能为空', 'trigger': 'blur' }],
          'jnpf_zcgl_zcdj_warrant_jnpf_propertyRight': [{ 'required': true, 'message': '产权性质不能为空', 'trigger': 'blur' }],
          'jnpf_zcgl_zcdj_warrant_jnpf_startTime': [{ 'required': true, 'message': '开始使用时间不能为空', 'trigger': 'blur' }],
          'jnpf_zcgl_zcdj_warrant_jnpf_endTime': [{ 'required': true, 'message': '使用到期时间不能为空', 'trigger': 'blur' }],
          'jnpf_zcgl_zcdj_area_jnpf_sharedLandArea': [{
            'required': true,
            'message': '证载共有土地面积不能为空',
            'trigger': 'blur'
          }],
          'jnpf_zcgl_zcdj_area_jnpf_buildingMeasurementArea': [{
            'required': true,
            'message': '建筑测量面积不能为空',
            'trigger': 'blur'
          }]
        },
      zcgl_cw_bill_itemexpenseItemOptions: [{ 'fullName': '选项一', 'id': '1' }, { 'fullName': '选项二', 'id': '2' }],
      zcgl_cw_bill_itemexpenseItemProps: { 'label': 'fullName', 'value': 'id' }
    }
  },
    computed: {
      // 获取名称显示
      provinceName() {
        const province = this.provinces.find(p => p.adcode === this.selectedProvince);
        return province ? province.name : '';
      },
      cityName() {
        const city = this.cities.find(c => c.adcode === this.selectedCity);
        return city ? city.name : '';
      },
      districtName() {
        const district = this.districts.find(d => d.adcode === this.selectedDistrict);
        return district ? district.name : '';
      },
      streetName() {
        const street = this.streets.find(s => s.adcode === this.selectedStreet);
        return street ? street.name : '';
      },
      formOperates() {
        // 安全检查：确保setting对象存在
        return (this.setting && this.setting.formOperates) || [];
      }
    },
  watch: {},
  created() {
    this.getzcStatus()
    this.getassetClassOptions()
    this.getzcPurposeOptions()
    this.getzcSourceOptions()
    this.getaffiliatedUnitOptions()
    this.getmanagementUnitOptions()

    this.getzcPurposeOptions()
    this.getzcSourceOptions()
    this.getaffiliatedUnitOptions()
    this.getmanagementUnitOptions()
    this.getholdingMethodOptions()
    this.dataAll()
    this.loadProvinces()

  },
  mounted() {
  },
  methods: {
    // 加载省份数据
    loadProvinces() {

      const amapKey = 'fc48e1e74dfb98fbde22eaca6abcbf2d' // 替换为你的高德API Key
      const url = `https://restapi.amap.com/v3/config/district?key=${amapKey}&keywords=中国&subdistrict=1&extensions=base`

      axios.get(url)
        .then(response => {
          if (response.data.status === '1' && response.data.districts && response.data.districts.length) {
            this.provinces = response.data.districts[0].districts
          } else {
            console.error('获取省份数据失败:', response.data.info)
            alert('获取省份数据失败，请检查API Key')
          }
        })
        .catch(error => {
          console.error('获取省份数据失败:', error)
          alert('获取省份数据失败，请稍后重试')
        })
    },

    // 省份选择变化
    onProvinceChange() {
      // 重置下级选择
      this.selectedCity = ''
      this.selectedDistrict = ''
      this.selectedStreet = ''
      this.districts = []
      this.streets = []

      if (!this.selectedProvince) return

      // 加载城市数据
      this.loadingCity = true
      this.loadCities(this.selectedProvince)
        .finally(() => {
          this.loadingCity = false
        })
    },

    // 城市选择变化
    onCityChange() {
      // 重置下级选择
      this.selectedDistrict = ''
      this.selectedStreet = ''
      this.streets = []

      if (!this.selectedCity) return

      // 加载区县数据
      this.loadingDistrict = true
      this.loadDistricts(this.selectedCity)
        .finally(() => {
          this.loadingDistrict = false
        })
    },

    // 区县选择变化
    onDistrictChange() {
      // 重置下级选择
      this.selectedStreet = ''

      if (!this.selectedDistrict) return

      // 加载街道数据
      this.loadingStreet = true
      this.loadStreets(this.selectedDistrict)
        .finally(() => {
          this.loadingStreet = false
        })
    },

    // 加载城市数据
    loadCities(adcode) {
      const amapKey = 'fc48e1e74dfb98fbde22eaca6abcbf2d' // 替换为你的高德API Key
      const url = `https://restapi.amap.com/v3/config/district?key=${amapKey}&keywords=${adcode}&subdistrict=1&extensions=base`

      return axios.get(url)
        .then(response => {
          if (response.data.status === '1' && response.data.districts && response.data.districts.length) {
            this.cities = response.data.districts[0].districts
          } else {
            console.error('获取城市数据失败:', response.data.info)
            this.cities = []
          }
        })
        .catch(error => {
          console.error('获取城市数据失败:', error)
          this.cities = []
        })
    },

    // 加载区县数据
    loadDistricts(adcode) {
      const amapKey = 'fc48e1e74dfb98fbde22eaca6abcbf2d' // 替换为你的高德API Key
      const url = `https://restapi.amap.com/v3/config/district?key=${amapKey}&keywords=${adcode}&subdistrict=1&extensions=base`

      return axios.get(url)
        .then(response => {
          if (response.data.status === '1' && response.data.districts && response.data.districts.length) {
            this.districts = response.data.districts[0].districts
          } else {
            console.error('获取区县数据失败:', response.data.info)
            this.districts = []
          }
        })
        .catch(error => {
          console.error('获取区县数据失败:', error)
          this.districts = []
        })
    },

    // 加载街道数据
    loadStreets(adcode) {
      const amapKey = 'fc48e1e74dfb98fbde22eaca6abcbf2d' // 替换为你的高德API Key
      const url = `https://restapi.amap.com/v3/config/district?key=${amapKey}&keywords=${adcode}&subdistrict=1&extensions=base`

      return axios.get(url)
        .then(response => {
          if (response.data.status === '1' && response.data.districts && response.data.districts.length) {
            this.streets = response.data.districts[0].districts
          } else {
            console.error('获取街道数据失败:', response.data.info)
            this.streets = []
          }
        })
        .catch(error => {
          console.error('获取街道数据失败:', error)
          this.streets = []
        })
    },

    // 街道选择变化
    onStreetChange() {

      // 添加延迟（“沉睡”），单位为毫秒（这里以 100ms 为例，可根据需求调整）
      console.log('最终选择:', this.selectedProvince, this.selectedCity, this.selectedDistrict, this.selectedStreet);
      this.dataForm.newData.provinceName = this.selectedProvince
      this.dataForm.newData.cityName = this.selectedCity
      this.dataForm.newData.districtName = this.selectedDistrict
      this.dataForm.newData.streetName = this.selectedStreet

    },

    getholdingMethodOptions() {
      getDictionaryDataSelector('610823865056100678').then(res => {
        this.holdingMethodOptions = res.data.list
      })
    },
    getzcStatus() {
      getDictionaryDataSelector('610000000000000000').then(res => {
        this.zcStatusOptions = res.data.list
      })
    },
    getassetClassOptions() {
      getDictionaryDataSelector('610000000000000001').then(res => {
        this.assetClassOptions = res.data.list
      })
    },
    // getzcNatureOptions() {
    //   getDictionaryDataSelector('610823452110094661').then(res => {
    //     this.zcNatureOptions = res.data.list
    //   })
    // },
    getzcPurposeOptions() {
      getDictionaryDataSelector('610823865056100677').then(res => {
        this.zcPurposeOptions = res.data.list
      })
    },
    getzcSourceOptions() {
      getDictionaryDataSelector('610823965094445381').then(res => {
        this.zcSourceOptions = res.data.list
      })
    },
    getaffiliatedUnitOptions() {
      getDictionaryDataSelector('610824055188095301').then(res => {
        this.affiliatedUnitOptions = res.data.list
      })
    },
    getmanagementUnitOptions() {
      getDictionaryDataSelector('610824142995849541').then(res => {
        this.managementUnitOptions = res.data.list
      })
    },
    getjnpf_zcgl_zcdj_warrant_jnpf_propertyRightOptions() {
      getDictionaryDataSelector('610826202277478725').then(res => {
        this.jnpf_zcgl_zcdj_warrant_jnpf_propertyRightOptions = res.data.list
      })
    },
    getjnpf_zcgl_zcdj_warrant_jnpf_useNatureOptions() {
      getDictionaryDataSelector('610826295164535109').then(res => {
        this.jnpf_zcgl_zcdj_warrant_jnpf_useNatureOptions = res.data.list
      })
    },
    updateDataRule() {
      let newRules = {}
      for (let i = 0; i < this.setting.formOperates.length; i++) {
        const item = this.setting.formOperates[i]
        if (!item.id.includes('-')) {
          const newRulesItem = {
            required: item.required || false,
            message: item.name + '不能为空',
            trigger: item.trigger || 'blur'
          }
          if (!this.dataRule.hasOwnProperty(item.id)) {
            if (item.required) this.$set(newRules, item.id, [newRulesItem])
          } else {
            let withoutRequiredItem = true
            for (let i = 0; i < this.dataRule[item.id].length; i++) {
              if (this.dataRule[item.id][i].hasOwnProperty('required')) {
                this.dataRule[item.id][i].required = item.required || false
                withoutRequiredItem = false
              }
            }
            if (withoutRequiredItem && item.required) this.dataRule[item.id].push(newRulesItem)
          }
        } else {
          let key = item.id.split('-')[0]
          let newId = item.id.split('-')[1]
          let newItem = {
            ...item,
            id: newId
          }
          if (!this.tableRequiredData.hasOwnProperty(key)) {
            this.$set(this.tableRequiredData, key, [newItem])
          } else {
            this.tableRequiredData[key].push(newItem)
          }
        }
      }
      this.dataRule = { ...this.dataRule, ...newRules }
    },
    exist() {
      let isOk = true
      let messageList = []
      for (let key in this.tableRequiredData) {
        let arr = this.tableRequiredData[key].filter((o) => o.required) || []
        for (let k = 0; k < arr.length; k++) {
          for (let i = 0; i < this.dataForm[key].length; i++) {
            let id = arr[k].id
            let name = arr[k].name
            let _data = this.dataForm[key][i][id]
            let boo = true
            if (Array.isArray(_data)) {
              boo = !this.jnpf.isEmptyArray(_data)
            } else {
              boo = !this.jnpf.isEmpty(_data)
            }
            if (!boo) {
              messageList.push(name + '不能为空')
            }
          }
        }
      }
      isOk = messageList.length == 0
      if (messageList.length > 0) {
        this.$message.error(messageList[0], 1000)
      }
      return isOk
    },
    dataAll() {
    },
    goBack() {
      this.$emit('refresh')
    },
    init(data) {
      if (data.flowTaskInfo != null) {

        console.log(data.flowTaskInfo)

        this.dataInfo3(data.flowTaskInfo.flowFormContentJson)
        this.$emit('setPageLoad')
        this.$store.commit('generator/UPDATE_RELATION_DATA', {})
        this.loading = false
        // this.dataForm.id = data.id || "";
        this.setting = data
        if (data.flowTaskInfo != null) {

          this.setting['readonly'] = true

        }
        // this.visible = true;
        this.updateDataRule()
        this.$forceUpdate()

      } else {
        this.$store.commit('generator/UPDATE_RELATION_DATA', {})
        this.loading = true
        this.dataForm.id = data.id || ''
        this.setting = data
        this.visible = true

        this.$nextTick(() => {
          // this.$refs['elForm'].resetFields();
          if (this.dataForm.id) {
            let url = '/api/example/ZcglZcdjInfo/' + this.dataForm.id
            if (this.dataForm.flowtaskid) {
              url += '?flowtaskid=' + this.dataForm.flowtaskid
            }
            request({
              url: url,
              method: 'get'
            }).then(res => {
              this.dataInfo(res.data)
              this.updateDataRule()
            })
          }
          this.loading = false
          this.$emit('setPageLoad')
        })
      }

    },
    // 表单提交
    dataFormSubmit(eventType, flowUrgent) {
      this.$refs['elForm'].validate((valid) => {
        if (valid) {
          if (!this.exist()) return
          if (eventType === 'audit' || eventType === 'reject') {
            var _data = this.dataList()
            this.$emit('eventReceiver', _data, eventType)
            return
          }
          this.dataForm.status = eventType === 'submit' ? 0 : 1
          this.dataForm.flowUrgent = flowUrgent
          this.dataForm.flowId = this.setting.flowId
          this.eventType = eventType
          if (this.eventType === 'submit') {
            this.$confirm('您确定要提交当前流程吗, 是否继续?', '提示', {
              type: 'warning'
            }).then(() => {
              this.request()
            }).catch(() => {
            })
          } else {
            this.request()
          }
        }
      })
    },
    request() {
      var _data = this.dataList()
      var id = this.dataForm.id
      delete this.dataForm.id
      // _data.oldData  = this.dataForm
      // _data.newData  = this.dataFormNew
      _data.type = '1'
      _data.zcdgId = id
      if (true) {
        request({
          url: '/api/example/ZcglZcdjInfoChange',
          method: 'post',
          data: _data
        }).then((res) => {
          this.$message({
            message: res.msg,
            type: 'success',
            duration: 1000,
            onClose: () => {
              this.visible = false
              this.$emit('close', true)
            }
          })
        })
      } else {
        request({
          url: '/api/ZcglCwBillChange/' + this.dataForm.id,
          method: 'PUT',
          data: _data
        }).then((res) => {
          this.$message({
            message: res.msg,
            type: 'success',
            duration: 1000,
            onClose: () => {
              this.visible = false
              this.$emit('close', true)
            }
          })
        })
      }
    },
    openDialogQuYu(){
      this.onOpen = true


     this.provinceName = null
      this.cityName = null
        this.districtName = null
     this.streetName = null

      this.selectedProvince = null
      this.selectedCity = null
      this.selectedDistrict = null
      this.selectedStreet = null


      this.loadProvinces()

    },

    judgeShow(id) {
      if (!this.setting.formOperates || !this.setting.formOperates.length) return true
      let arr = this.setting.formOperates.filter(o => o.id === id) || []
      if (!arr.length) return true
      let item = arr[0]
      return item.read
    },
    judgeWrite(id) {
      if (!this.setting.formOperates || !this.setting.formOperates.length) return false
      let arr = this.setting.formOperates.filter(o => o.id === id) || []
      if (!arr.length) return true
      let item = arr[0]
      return !item.write
    },
    judgeRequired(id) {
      if (!this.setting.formOperates || !this.setting.formOperates.length) return false
      let arr = this.setting.formOperates.filter(o => o.id === id) || []
      if (!arr.length) return true
      let item = arr[0]
      return item.required
    },
    addzcbillitemList() {
      this.tableKey = 'zcbillitemList'
      let item = {
        expenseItem: undefined,
        receiveAmount: undefined
      }
      this.dataForm.zcbillitemList.push(item)
    },
    delzcbillitemList(index) {
      this.dataForm.zcbillitemList.splice(index, 1)
    },
    // 获取选项标签
    getOptionLabel(options, value) {
      const item = options.find(opt => opt.id === value)
      return item ? item.fullName : ''
    },
    dataList() {
      var _data = JSON.parse(JSON.stringify(this.dataForm))

      return _data
    },
    dataInfo3(dataAll) {

      // let _dataAll = JSON.parse(dataAll)
      let _dataAll = JSON.parse(dataAll)
      console.log('asas阿萨·' + _dataAll)
      console.log('asas阿萨·' + _dataAll.oldData)

      function safeParseJSON(data) {
        try {

          return typeof data === 'string' ? JSON.parse(data) : data
        } catch (e) {
          console.error('Parsing error:', e)
          return null // 或者根据需要返回其他默认值
        }
      }

// 处理 oldData 中的 zcFile 和 zcFmImage
      if (_dataAll.oldData) {
        let oldDataParsed = safeParseJSON(_dataAll.oldData)
        if (oldDataParsed) {
          if (oldDataParsed.zcFile != '') {
            oldDataParsed.zcFile = oldDataParsed.zcFile ? JSON.parse(oldDataParsed.zcFile) : []

          }

        }
      }

// 处理 newData 中的 zcFile 和 zcFmImage
      if (_dataAll.newData) {
        let newDataParsed = safeParseJSON(_dataAll.newData)
        if (newDataParsed) {
          if (newDataParsed.zcFile != '') {
            newDataParsed.zcFile = newDataParsed.zcFile ? JSON.parse(newDataParsed.zcFile) : []
          }
        }
      }

      this.dataForm = Object.assign({}, this.dataForm, _dataAll)
      // this.dataForm = _dataAll
      if (typeof this.dataForm.oldData === 'string') {

        this.dataForm.oldData = JSON.parse(this.dataForm.oldData)

      } else {
        this.dataForm.oldData = this.dataForm.oldData
      }

      if (typeof this.dataForm.newData === 'string') {
        this.dataForm.newData = JSON.parse(this.dataForm.newData)

      } else {
        this.dataForm.newData = this.dataForm.newData
      }

      // this.dataFormNew = JSON.parse(JSON.stringify(this.dataForm))
    },
    dataInfo(dataAll) {
      let _dataAll = dataAll
      if (_dataAll.zcFile != null && dataAll.zcFile != '') {
        _dataAll.zcFile = JSON.parse(_dataAll.zcFile)

      } else {
        _dataAll.zcFile = ''
      }
      if (_dataAll.zcFmImage != null && dataAll.zcFmImage != '') {
        _dataAll.zcFmImage = JSON.parse(_dataAll.zcFmImage)

      } else {
        _dataAll.zcFmImage = ''
      }
      this.dataForm.oldData = _dataAll

      this.dataForm.newData = JSON.parse(JSON.stringify(this.dataForm.oldData))
      // this.dataFormNew = JSON.parse(JSON.stringify(this.dataForm))
    },
    dataInfo2(dataAll) {
      let _dataAll = dataAll

      if (_dataAll.zcFile != null && dataAll.zcFile != '') {
        _dataAll.zcFile = JSON.parse(_dataAll.zcFile)

      } else {
        _dataAll.zcFile = ''
      }
      if (_dataAll.zcFmImage != null && dataAll.zcFmImage != '') {
        _dataAll.zcFmImage = JSON.parse(_dataAll.zcFmImage)

      } else {
        _dataAll.zcFmImage = ''
      }
      this.dataForm = _dataAll
      this.$forceUpdate()

    },
    dataInfo1(dataAll) {
      let _dataAll = dataAll
      // for(let i=0;i<_dataAll.zcbillitemList.length;i++){
      //   var _list = _dataAll.zcbillitemList[i];
      //   _list.expenseItem = _list.expenseItem
      // }
      if (_dataAll.zcFile != null && dataAll.zcFile != '') {
        _dataAll.zcFile = JSON.parse(_dataAll.zcFile)

      } else {
        _dataAll.zcFile = ''
      }
      this.dataForm.newData = _dataAll
    },
    addForSelect(data) {
      for (let i = 0; i < data.length; i++) {
        let item = data[i]
        this.dataForm[this.tableKey].push(item)
      }
    },
    confirmQy(){
      if(this.provinceName == ''
      || this.cityName == ''
      || this.districtName == ''
      || this.streetName == ''

      ){
        this.$message.error("请选择完整", 1000)
        return
      }

        this.dataForm.newData.provinceName = this.provinceName
      this.dataForm.newData.cityName = this.cityName
      this.dataForm.newData.districtName = this.districtName
      this.dataForm.newData.streetName = this.streetName
      this.onOpen = false
    }
  }
}

</script>
<style scoped>
.el-textarea.is-disabled .el-textarea__inner {

  color: black !important;
}

.el-input.is-disabled .el-input__inner {
  color: black !important;

}

/deep/ .el-input__inner {
  background: white !important;

}

/deep/ .el-textarea__inner {
  background: white !important;
}

.el-input.is-disabled .el-input__inner {

  background: white !important;
}
</style>
